﻿using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Security.Principal;
using System.Diagnostics;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Security;
using SAKS.Models;
using SAKS.ViewModels;
using SAKS.IServices;
using SAKS.ActionFilters;
using AutoMapper;
using log4net;
using log4net.Repository.Hierarchy;


namespace SAKS.Controllers
{
    [Authorize]
    public class PictureController : ControllerBase
    {

        public IPictureServices PictureServices { get; set; }

        protected override void Initialize(RequestContext requestContext)
        {
            base.Initialize(requestContext);
            PictureServices.Session = GetCurrentSession(requestContext);
        }

        public ImageResult Original(Guid id)
        {
            var image = PictureServices.GetOriginal(id);
            return new ImageResult() {Image = image,ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg };
        }

        public ActionResult Thumbnail(Guid id)
        {
            var image = PictureServices.GetThumbnail(id);
            return new ImageResult() { Image = image, ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg };
        }

    }



}
